<html>
<head><meta charset="utf-8"><title>Code mixing `Option`/`Result` in `?` (RFC#3058) · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html">Code mixing `Option`/`Result` in `?` (RFC#3058)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227125545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227125545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227125545">(Feb 20 2021 at 23:02)</a>:</h4>
<p>It turns out rust-analyzer has an example of how to do the mixing without even a custom error type, by getting it inferred in a closure:<br>
<a href="/user_uploads/4715/aMFZPd7-yz-x51Js1CWr9Y5W/image.png">image.png</a><br>
Code not as an image, with the fix to stop interconverting: <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7735/files#diff-d28550e97c9f896dcfc83614dbec25537cf8a3eee404200ba37d9c9929077249R76">https://github.com/rust-analyzer/rust-analyzer/pull/7735/files#diff-d28550e97c9f896dcfc83614dbec25537cf8a3eee404200ba37d9c9929077249R76</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/aMFZPd7-yz-x51Js1CWr9Y5W/image.png" title="image.png"><img src="/user_uploads/4715/aMFZPd7-yz-x51Js1CWr9Y5W/image.png"></a></div><p>This is a <code>-&gt; Option&lt;()&gt;</code> method, and inside the closure it's using <code>.find_map(...)?</code> from iterator, so it's on an <code>Option</code>.  But then it's also mapping to <code>Ok(...)</code> and using <code>.collect::&lt;Result&lt;_, _&gt;&gt;()?</code>.</p>
<p>I'm continuing towards being able to do crater (<a href="https://github.com/rust-lang/rust/pull/82318">https://github.com/rust-lang/rust/pull/82318</a>), but any thoughts?</p>
<p>Personally, this is pushing me towards thinking an edition change could be worth it.  (Sketch: have a perma-unstable <code>FromResidual2018</code> used in 2018 and earlier in the <code>?</code> desugaring, but everything else is the same.  And lint on use of the option&lt;-&gt;result implementation of that.)</p>
<p>cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span>, who might not be following <a class="stream" data-stream-id="219381" href="/#narrow/stream/219381-t-libs">#t-libs</a></p>



<a name="227152146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227152146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227152146">(Feb 21 2021 at 08:15)</a>:</h4>
<p>Let's see what the crater run will give us. If this is the only example we can find, then continuing with this small breakage might still make more sense than an edition change. Edition changes are not great, because it means having to maintain both solutions forever.</p>



<a name="227182209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227182209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227182209">(Feb 21 2021 at 17:36)</a>:</h4>
<p>Weren't we already going to keep supporting the accidental <code>Option</code>-&gt;<code>Result</code>? Why wouldn't we do the same the other way?<br>
<code>impl FromResidual&lt;Result&lt;T, PseudoStableNoneError&gt;&gt; for Option&lt;U&gt;</code></p>



<a name="227189348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227189348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227189348">(Feb 21 2021 at 19:42)</a>:</h4>
<blockquote>
<p>Weren't we already going to keep supporting the accidental Option-&gt;Result?</p>
</blockquote>
<p>If we can remove it without much breakage, that might be worth it.</p>



<a name="227189481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227189481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227189481">(Feb 21 2021 at 19:45)</a>:</h4>
<p>I'd been thinking of keeping the option-&gt;result direction because it comes from using generics, so for some reason felt less bad to me.  Whereas Result-&gt;Option requires having the <code>Result&lt;_, NoneError&gt;</code> specifically, which should be harder.  (Except apparently it's not that much harder, given closures.)</p>



<a name="227189636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227189636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227189636">(Feb 21 2021 at 19:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="310399">Mara</span> <a href="#narrow/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058)/near/227152146">said</a>:</p>
<blockquote>
<p>Edition changes are not great, because it means having to maintain both solutions forever.</p>
</blockquote>
<p>That's of course true.  This one felt like it wouldn't be too impactful, though -- just one "call this lang item vs that lang item" in the <code>?</code> desugar.  And the alternative is that the unwanted conversion becomes part of the trait system, which means that it can't be removed later in an edition even if we wanted to.</p>



<a name="227189693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227189693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227189693">(Feb 21 2021 at 19:48)</a>:</h4>
<p>(And doing an edition change would allow things like using <code>Into</code> for result error-conversion while we're at it, for basically no extra cost.)</p>



<a name="227189733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227189733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227189733">(Feb 21 2021 at 19:49)</a>:</h4>
<p>Sure, not ruling it out. Just saying that it might be okay without an edition change if the breakage is small.</p>



<a name="227189906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227189906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227189906">(Feb 21 2021 at 19:52)</a>:</h4>
<p>That'd certainly make me happiest <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>
<p>(I'm just less confident than I used to be when just making the try build broke before even getting to the crater run.)</p>



<a name="227337690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227337690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227337690">(Feb 22 2021 at 21:09)</a>:</h4>
<p>I'd like to be starting to use editions more</p>



<a name="227337702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227337702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227337702">(Feb 22 2021 at 21:09)</a>:</h4>
<p>and less breakage</p>



<a name="227337711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227337711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227337711">(Feb 22 2021 at 21:09)</a>:</h4>
<p>it's <em>really hard</em> to judge the impact of breakage</p>



<a name="227363291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227363291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227363291">(Feb 23 2021 at 00:27)</a>:</h4>
<p>in this case, I think continuing to support <code>NoneError</code> weirdness would be better than forking <code>?</code> behavior</p>



<a name="227363940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227363940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227363940">(Feb 23 2021 at 00:33)</a>:</h4>
<p>did we ever run the crater where we remove the <code>Debug</code> impl on <code>NoneError</code>?</p>



<a name="227364313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227364313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227364313">(Feb 23 2021 at 00:36)</a>:</h4>
<p>I don't think that hole really depends on <code>Debug</code> per se -- it's just semi-plausible that an error might convert <code>T: Debug</code></p>



<a name="227364505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227364505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227364505">(Feb 23 2021 at 00:38)</a>:</h4>
<p>you can use any generic bound, as long as it doesn't overlap your error's reflexive <code>From&lt;T&gt; for T</code></p>



<a name="227365178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227365178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227365178">(Feb 23 2021 at 00:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058)/near/227363940">said</a>:</p>
<blockquote>
<p>did we ever run the crater where we remove the <code>Debug</code> impl on <code>NoneError</code>?</p>
</blockquote>
<p>That wouldn't have solved the <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7735">https://github.com/rust-analyzer/rust-analyzer/pull/7735</a> regression.</p>
<p>The run of my prototype without the <code>mod sadness</code> is queued in <a href="https://crater.rust-lang.org/ex/pr-82322">https://crater.rust-lang.org/ex/pr-82322</a></p>



<a name="227366311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227366311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227366311">(Feb 23 2021 at 00:56)</a>:</h4>
<p>Hmm, all this stuff is in <code>core</code>.  I think coherence will let me get away with a blanket impl here that would make differences between editions almost unnoticable.  I'll have to give that a try and see...</p>



<a name="227375389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227375389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227375389">(Feb 23 2021 at 02:49)</a>:</h4>
<p>and if coherence doesn't let you get away with it, just add a lang item <a href="https://github.com/rust-lang/rust/blob/11f838d64ae764c6016c2c00f958bec61e9a2691/library/std/src/f32.rs#L31-L32">https://github.com/rust-lang/rust/blob/11f838d64ae764c6016c2c00f958bec61e9a2691/library/std/src/f32.rs#L31-L32</a> :)</p>



<a name="227382984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227382984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227382984">(Feb 23 2021 at 05:01)</a>:</h4>
<p>That works great for inherent -- I'm be a little more scared for trait impls <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="227391356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227391356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227391356">(Feb 23 2021 at 07:27)</a>:</h4>
<p>Well, I think the idea worked -- it's a very small change to make it edition-sensitive: <a href="https://github.com/scottmcm/rust/commit/a76ae8ff5fc085a90fa7f09c8d62b6556539822a">https://github.com/scottmcm/rust/commit/a76ae8ff5fc085a90fa7f09c8d62b6556539822a</a></p>
<p>Certainly doing it for real would need some more tests, but given the blanket impl works and how small the compiler change is this, I think I'm personally now in "should do an edition break" camp.  Basically it can be thought of as "there's two edition-specific <code>impl</code>s, but everything else is the same", which seems tolerable to me.</p>
<p>Dunno what that means I should do with the RFC, though.  I guess update it to have the edition break?  At least as an unresolved question?  Makes me want a lang+libs+edition straw poll before doing that, though...</p>
<p>Does seeing this change make you feel better about a potential edition change?  (<span class="user-mention" data-user-id="138448">@cuviper</span>/@<strong>Mara</strong>/others?)  Or are the details of the change relatively unimportant, with the fact that one exists at all being the most critical factor?</p>



<a name="227395021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227395021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227395021">(Feb 23 2021 at 08:15)</a>:</h4>
<p>Very interesting</p>



<a name="227395221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227395221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227395221">(Feb 23 2021 at 08:17)</a>:</h4>
<p>That looks perfectly acceptable to me. I suppose the legacy trait could be perma-unstable, but it's minor even if we did stabilize it.</p>



<a name="227395622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/227395622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#227395622">(Feb 23 2021 at 08:22)</a>:</h4>
<p>Yeah, I was thinking perma-unstable because I don't think anyone could actually implement it on anything anyway, because of that blanket impl.</p>



<a name="229215352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229215352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229215352">(Mar 07 2021 at 20:26)</a>:</h4>
<p>Crater results are in!  <a href="https://crater-reports.s3.amazonaws.com/pr-82322/index.html">https://crater-reports.s3.amazonaws.com/pr-82322/index.html</a></p>
<p>This is the run with neither <code>Option -&gt; Result</code> nor <code>Result -&gt; Option</code> interconversion.</p>
<p>747 regressed crates, though 623 of those are are from Rocket's <code>Outcome: Try</code>: <a href="https://api.rocket.rs/v0.4/rocket/enum.Outcome.html#impl-Try">https://api.rocket.rs/v0.4/rocket/enum.Outcome.html#impl-Try</a></p>
<p>The most interesting failure I've seen so far is another instance of the pattern that lead to me opening this topic: <a href="https://github.com/Nadrieril/dhall-rust/blob/9138e0fae758d4beb2188d03fbafaa1893e497f5/serde_dhall/src/value.rs#L481">https://github.com/Nadrieril/dhall-rust/blob/9138e0fae758d4beb2188d03fbafaa1893e497f5/serde_dhall/src/value.rs#L481</a></p>
<p>(There's a smaller version of the pattern as a test in my "what would it take to make this edition-specific" branch -- <a href="https://github.com/scottmcm/rust/commit/do-or-do-not-edition#diff-5b03cfd559db8aadb574643482703a3aaba13108429108aefcad105f79f14f65R11">https://github.com/scottmcm/rust/commit/do-or-do-not-edition#diff-5b03cfd559db8aadb574643482703a3aaba13108429108aefcad105f79f14f65R11</a> -- if you'd like one where it's easier to what's happening)</p>
<p>I think my plan will be to update the RFC to be the edition plan.  That would be helpful anyway as the easiest way to more forward -- it could go in on nightly without trouble, since it doesn't break things.  And we could always add the implementations back in the newer editions later if we end up wanting to do so.  (Although I'd rather not, because the error messages are much cleaner without the interconversion implementations.)</p>



<a name="229216085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229216085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229216085">(Mar 07 2021 at 20:38)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Presumably the issue with rocket will need to go away anyway as they work on moving off of nightly?</p>



<a name="229216252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229216252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229216252">(Mar 07 2021 at 20:40)</a>:</h4>
<p>Rocket's build fails because it's trying to implement the old <code>Try</code>, making it hard to tell whether there'd be any breaking changes.  But I'd expect that yes, it'd either go away by just implementing the new <code>Try</code> when that's on nightly, or moving off nightly altogether.</p>



<a name="229216430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229216430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229216430">(Mar 07 2021 at 20:43)</a>:</h4>
<p>Considering that it's on nightly and using a nightly-only feature, I think we can ignore that breakage as it'll break <em>anyway</em> when we change <code>Try</code>.</p>



<a name="229216431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229216431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229216431">(Mar 07 2021 at 20:43)</a>:</h4>
<p>(There are also some crates failing because they use the nightly feature to mention <code>NoneError</code> directly, which is of course allowed breakage.)</p>



<a name="229216503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229216503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229216503">(Mar 07 2021 at 20:44)</a>:</h4>
<p>Agreed, I meant that more as "so the interesting number is more like 124".  (Though that's still not the "real breakage" number.)</p>



<a name="229295085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229295085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229295085">(Mar 08 2021 at 13:10)</a>:</h4>
<p>would be nice if we could run a stable-only crater run</p>



<a name="229302059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229302059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229302059">(Mar 08 2021 at 13:58)</a>:</h4>
<p>You can, if you want to, by editing the release channel and doing two try builds in quick succession (one to get master but as stable and one to get your PR as stable).</p>



<a name="229302099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229302099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229302099">(Mar 08 2021 at 13:59)</a>:</h4>
<p>src/ci/run.sh</p>



<a name="229367427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/229367427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#229367427">(Mar 08 2021 at 20:21)</a>:</h4>
<p>Agreed, Mara.  I opened <a href="https://github.com/rust-lang/crater/issues/563">https://github.com/rust-lang/crater/issues/563</a> yesterday with the related idea that it would be nice for crater to flag "this uses nightly-only features" crates separately.</p>



<a name="230471952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230471952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230471952">(Mar 16 2021 at 07:58)</a>:</h4>
<p>Oof, I wish there was a better way to find these than manually looking:<br>
<a href="/user_uploads/4715/O8G2adRe7T9HFxqEQgYifTUU/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/O8G2adRe7T9HFxqEQgYifTUU/image.png" title="image.png"><img src="/user_uploads/4715/O8G2adRe7T9HFxqEQgYifTUU/image.png"></a></div>



<a name="230476317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230476317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230476317">(Mar 16 2021 at 08:32)</a>:</h4>
<p>is this something you could search for using <span class="user-mention" data-user-id="116109">@Vytautas Astrauskas [he/him]</span> 's et al rustql/qrates ? <a href="https://github.com/rust-corpus/qrates">https://github.com/rust-corpus/qrates</a></p>



<a name="230476941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230476941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230476941">(Mar 16 2021 at 08:38)</a>:</h4>
<p>That looks awesome, but it feels like it's probably overkill when I already have crater results to know what crates to look at.</p>
<p>It's narrowed down enough that it's not that bad, just tedious.</p>



<a name="230476996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230476996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230476996">(Mar 16 2021 at 08:39)</a>:</h4>
<p>Has found some gems, too -- this is probably the cleanest example yet of the mixing problem this thread is about:<br>
<a href="https://github.com/thejohncrafter/Verifier/pull/1/files">https://github.com/thejohncrafter/Verifier/pull/1/files</a></p>



<a name="230555038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230555038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230555038">(Mar 16 2021 at 17:21)</a>:</h4>
<p>Looks like there are only 4 "real" regressions.  Full analysis of the crater results: <a href="https://github.com/rust-lang/rust/pull/82322#issuecomment-800452140">https://github.com/rust-lang/rust/pull/82322?#issuecomment-800452140</a></p>
<p>It did confirm that the "I'm <code>From</code> anything" isn't common, though -- the only case was <a href="https://lib.rs/crates/yolo-block">https://lib.rs/crates/yolo-block</a>, which suggests that it can only be used by nightly crates (and the crate "was primarily written as a joke").</p>



<a name="230555270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230555270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230555270">(Mar 16 2021 at 17:22)</a>:</h4>
<p>oh nice. that's not bad at all</p>



<a name="230556990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230556990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230556990">(Mar 16 2021 at 17:31)</a>:</h4>
<p>I've made PRs for the three important ones (two of which are merged, the third is an abandoned project), so it makes me ponder doing the edition version, but as a path to remove the back-compat thing from the previous editions at some point in the future.</p>



<a name="230559357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230559357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230559357">(Mar 16 2021 at 17:45)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> why not do it in all editions? breakage is very small right, or do you want to avoid breakage for the crates that depend on the nightly features too?</p>



<a name="230560483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/230560483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#230560483">(Mar 16 2021 at 17:51)</a>:</h4>
<p>I guess I'm nervous that there are more cases of it hidden somewhere (EDIT: in code that crater can't see).  It's a weird thing in that it seems <em>more</em> likely to happen in advanced-and-complicated rust code, since it depends on somewhat complicated combinator chains to happen.</p>
<p>If people are happy to do it on all editions I'd be happy to do that -- I'm just generally more willing to do breakage than many others on teams, so I'm trying to cautious <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="232534507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/232534507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#232534507">(Mar 31 2021 at 04:25)</a>:</h4>
<p>FYI libs folks: I updated the RFC to just do it in all editions, and niko has p-FCP'd it: <a href="https://github.com/rust-lang/rfcs/pull/3058#issuecomment-810690641">https://github.com/rust-lang/rfcs/pull/3058#issuecomment-810690641</a></p>



<a name="232537187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Code%20mixing%20%60Option%60/%60Result%60%20in%20%60%3F%60%20%28RFC%233058%29/near/232537187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Code.20mixing.20.60Option.60.2F.60Result.60.20in.20.60.3F.60.20(RFC.233058).html#232537187">(Mar 31 2021 at 05:04)</a>:</h4>
<p>Really excited to see that!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>